package com.example.administrator.nurse.present;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.nurse.R;
import com.example.administrator.nurse.base.BaseActivity;
import com.example.administrator.nurse.common;
import com.example.administrator.nurse.model.bean.OrderActivityBean;
import com.example.administrator.nurse.util.imageLoderHelper;
import com.nostra13.universalimageloader.core.ImageLoader;

/**
 * Created by Administrator on 2016/4/22.
 */


public class OrderInfoActivity extends BaseActivity {

    private ImageLoader imageLoader = ImageLoader.getInstance();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        configCommonHeader(OrderInfoActivity.this,getResources().getString(R.string.order_info),1);
        initViews(getIntent());
    }

    @Override
    protected int setLayotId() {
        return R.layout.order_info_layout;
    }

    private void initViews(Intent intent){
        OrderActivityBean bean = (OrderActivityBean) intent.getSerializableExtra("data");
        imageLoader.displayImage(
                common.Host+"/"+bean.getUrl(),
                (ImageView) f(R.id.head),
                imageLoderHelper.getLoderOption(R.mipmap.user, 170)
        );
        ((TextView)f(R.id.hospital_order)).setText(bean.getHospital());

        String[] infos = bean.getInfo().replace("病人信息:", "").split(",");
        ((TextView)f(R.id.name)).setText(infos[0]);
        ((TextView)f(R.id.sex)).setText(infos[1]);
        ((TextView)f(R.id.age)).setText(infos[2]);

        TextView content = (TextView) f(R.id.order_content);
        content.setText(bean.getContent());

        ((TextView)f(R.id.start_data)).setText(bean.getStartTime());
        ((TextView)f(R.id.end_data)  ).setText(bean.getOverTime());

        TextView execute_note = (TextView) f(R.id.execute_note);
        execute_note.setText(bean.getTime().replace("执行时间:","")+",已执行");
    }

    @Override
    protected void onFailure(int requestCode, Object object, String errorMsg) {

    }

    @Override
    protected void onSuccess(int requestCode, Object object, String response) {

    }
}
